package com.zjy.service.impl;

import com.zjy.bean.GoodsBrand;
import com.zjy.dao.GoodsBrandMapper;
import com.zjy.service.GoodsBrandService;
import com.zjy.utils.UUIDUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Administrator on 2019/4/11.
 */
@Service
public class GoodsBrandServiceImpl implements GoodsBrandService{
    @Resource
    private GoodsBrandMapper goodsBrandMapper;

    @Override
    public int checkExistType(int type) {
        return goodsBrandMapper.checkExistType(type);
    }

    @Override
    public void addGoodsBrand(GoodsBrand goodsBrand) {
        String id = UUIDUtils.getUUID();
        goodsBrand.setId(id);
        goodsBrandMapper.insertSelective(goodsBrand);
    }

    @Override
    public int deleteGoodsBrandById(String brandId) {
        return goodsBrandMapper.deleteGoodsBrandById(brandId);
    }

    @Override
    public int updateGoodsBrandById(GoodsBrand goodsBrand) {
        return goodsBrandMapper.updateByPrimaryKeySelective(goodsBrand);
    }

    @Override
    public GoodsBrand selectGoodsBrandById(String brandId) {
        return goodsBrandMapper.selectGoodsBrandById(brandId);
    }

    @Override
    public List<GoodsBrand> selectAllGoodsBrand() {
        return goodsBrandMapper.selectAllGoodsBrand();
    }
}
